const Mock = require('mockjs')

const Random = Mock.Random

let Result = {
  code: 200,
  msg: '操作成功',
  data: null
}


Mock.mock('/captcha', 'get', () => {
  Result.data = {
    token: Random.string(32),
    captchaImg: Random.dataImage('90x40', 'p7n5w')
  }
  return Result
})

Mock.mock('/login', 'post', () => {

  // Result.code = 400
  // Result.msg = "验证码错误"
  return Result
})

Mock.mock('/sys/userInfo', 'get', () => {
  Result.data = {
    id: "1",
    username: "test",
    avatar: ""
  }
  return Result
})

Mock.mock('/logout', 'post', () => {

  return Result
})

Mock.mock('/sys/menu/nav', 'post', () => {

  let nav=[]
  let authoritys=[]

  Result.data={

    nav:nav,
    authoritys: authoritys

  }

  return Result
})


